<?php
class SettingModel extends ModelIdName
{
    protected $resourceId = 'AdminResource';
    protected static $instance;

    public static function GetInstance()
    {
        if (is_null(self::$instance)) self::$instance = new SettingModel();
        return self::$instance;
    }

    public static function Get($id)
    {
        if(empty($id)) throw new Exception('Key is empty');
        return self::GetInstance()->FindScalarById($id, 'name');
    }

    public static function Set($id, $value)
    {
        $item['id'] = $id;
        $item['name'] = $value;
        return $this->Save($item);
    }
}
?>
